package com.tadpole.music.view.widget;

import android.app.Activity;
import android.view.View;
import android.view.animation.Animation;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;

import com.tadpole.music.R;

import razerdp.basepopup.BasePopupWindow;

/**
 * Created By 孙岩
 * on 2020/9/11
 */
public class PayPopupSuccess extends BasePopupWindow implements View.OnClickListener{
    //快去答题
    private TextView tvGo;
    //关闭
    private ImageView ivClose;
    private IModeSelection iModeSelection;
    //flag = 1是题库 flag = 2是套题
    private String flag;
    public PayPopupSuccess(Activity context,String flag) {
        super(context);
        ivClose = (ImageView) findViewById(R.id.ivClose);
        tvGo = (TextView) findViewById(R.id.tvGo);
        tvGo.setOnClickListener(this);
        ivClose.setOnClickListener(this);
        if("1".equals(flag)){
            tvGo.setText("快去答题");
        }else if("2".equals(flag)){
            tvGo.setText("确定");
        }
    }


    @Override
    protected Animation initShowAnimation() {
        return null;
    }

    @Override
    public View getClickToDismissView() {
        return getPopupWindowView();
    }

    @Override
    public View onCreatePopupView() {
        return createPopupById(R.layout.pop_pay_success);
    }

    @Override
    public View initAnimaView() {
        return findViewById(R.id.rlSuccess);
    }

    public void setModeListener(IModeSelection iModeSelection) {
        this.iModeSelection = iModeSelection;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tvGo:
                iModeSelection.getMode(1);
                break;
            case R.id.ivClose:
                iModeSelection.getMode(2);
                break;
        }
    }

    public interface IModeSelection{
        void getMode(int mode);
    }
}

